home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_10 / vesely / common < prev    next >
Text File  |  1995-08-02  |  726b  |  37 lines

  1. // .h
  2. #ifdef _DEBUG
  3. void SqlTrace( LPCSTR);
  4. #define TRACESQL(sz) ::SqlTrace(sz)
  5. #else
  6. inline void __cdecl SqlTrace(LPCSTR) { }
  7. #define TRACESQL  1 ? (void)0 : ::SqlTrace
  8. #endif
  9.  
  10. // .cpp
  11. #ifdef _DEBUG
  12. // tracing strings longer than 512
  13. void SqlTrace(LPCSTR pszSQL)
  14. {
  15.    ASSERT( AfxIsValidString( pszSQL));
  16.  
  17.    if (afxTraceFlags & 0x20)  // if db tracing
  18.    {
  19.       char *pszFormat = "SQL : %s\n";
  20.       int n = strlen( pszSQL);
  21.       char *psz = (char *) pszSQL;
  22.       while ( n)
  23.       {
  24.          int n1 = n > 110 ? 100 : n;
  25.          n -= n1;
  26.          char ch = psz[n1];
  27.          psz[n1] = 0;
  28.          AfxTrace( pszFormat, psz);
  29.          psz += n1;
  30.          *psz = ch;
  31.          pszFormat = "...   %s\n";
  32.       }
  33.    }
  34. }
  35. #endif
  36.  
  37.